package com.example.springboottestgit.service.instruction.stage1;

import com.example.springboottestgit.bean.InstructData;
import com.example.springboottestgit.common.RunNum;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;
import java.util.Random;

/**
 * @description:合同签订时限
 * @author: ZZZ
 */

@Service
public class ContractTimeLimit {
    static int n = 0;

    public List<InstructData> getInstructData() {
        List<InstructData> list = new ArrayList<>();
        for (int i = 1; i <= RunNum.a; i++) {
            list.add(mul(i % 2 == 0));
        }
        return list;
    }

    //投标有效期指令
    public InstructData mul(Boolean b) {
        int x = 30;
        if (b == true) {
            //x = random.nextInt(60) + 1;
            n++;
            x = n;
            if (n == 61) {
                n = 0;
                x = 30;
            }
        }

        String sign = x == 30 ? "符合" : "不符合";
        String e = x == 30 ? "等于" : "不等于";


        String instruction = "合同签订时限为自中标通知书发出之日起x个日历日内是否符合法律法规";
        String input = "";
        String output = "#。根据《中华人民共和国招标投标法》第四十六条，招标人和中标人应当自中标通知书发出之日起30日内，按照招标文件和中标人的投标文件订立书面合同，因此案例合同签订时限为自中标通知书发出之日起x个日历日内#法律法规。";

        instruction = instruction.replace("x", x + "");
        output = output.replace("x", x + "").replace("#", sign + "").replace("e", e + "");

        InstructData instructData = new InstructData();
        instructData.setInstruction(instruction);
        instructData.setInput("");
        instructData.setOutput(output);
        return instructData;
    }
}
